package com.tien.action;

import java.util.HashMap;
import java.util.Map;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.tien.utils.AbstractAction;
import com.tien.utils.mail.Mailer;

/**
 * @author Tien E-mail:g.tianxin@gmail.com
 * @version Time：2011-6-29 上午12:06:46
 */
@Controller
@Scope("prototype")
public class MailAction extends AbstractAction{
	/**
	 * 
	 */
	private static final long serialVersionUID = -7562660988408559418L;
	private Map<String, String> recipients = new HashMap<String, String>();
	private String recipients_str;
	private String mailContent;
	private String subject;

	public String execute() {
		String[] recipitentsArray = recipients_str.split(";");
		for(String recipitent : recipitentsArray){
			recipients.put(recipitent, recipitent);
		}
		Mailer.getInstance().sendSimpleEmail("g.tianxin@gmail.com", "TienXin", recipients, subject, mailContent);
		System.out.println("--- The End----");
		return null;
	}

	public Map<String, String> getRecipients() {
		return recipients;
	}

	public void setRecipients(Map<String, String> recipients) {
		this.recipients = recipients;
	}

	public String getMailContent() {
		return mailContent;
	}

	public void setMailContent(String mailContent) {
		this.mailContent = mailContent;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getRecipients_str() {
		return recipients_str;
	}

	public void setRecipients_str(String recipients_str) {
		this.recipients_str = recipients_str;
	}
}
